package sparrowGui.event
{
	import flash.events.Event;
	
	import sparrowGui.item.Item;
	
	/**
	 * 麻雀GUI的事件机制
	 * 一般列表项会用上此机制,如列表更新,列表选中,方便通过此事件重写解析子项方法.
	 * @author Pelephone
	 */	
	public class SparrowEvent extends Event
	{
		private var _body:Object;
		public function SparrowEvent(type:String, obj:Object=null, bubbles:Boolean=false, cancelable:Boolean=false)
		{
			_body = obj;
			super(type, bubbles, cancelable);
		}

		public function get body():Object
		{
			return _body;
		}
		
		public function get bodyItem():Item
		{
			return _body as Item;
		}
		
		//将数据转换整型
		public function get dataInt():int
		{
			return int(_body);
		}
		
		//将数据转换布尔
		public function get dataBool():Boolean
		{
			return Boolean(_body);
		}
		
		//将数据转换数值
		public function get dataNum():Number
		{
			return Number(_body);
		}
		
		//将数据转换字符型
		public function get dataStr():String
		{
			return String(_body);
		}
		
		//将数据转换数组型
		public function get dataArr():Array
		{
			return (_body as Array);
		}
	}
}